home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / Gui4Cli / Dir / Dir.gc.alt < prev    next >
Encoding:
Text File  |  1980-01-03  |  7.0 KB  |  325 lines

  1. G4C
  2.  
  3. ; This is an alternate dir.gc which uses a separate gui for
  4. ; the favourites directories.
  5.  
  6. ; To use this dir.gc, instead of the normal one, just replace
  7. ; the dir.gc file in the main "Dir" directory with this file,
  8. ; i.e. rename dir.gc to something else and rename this file
  9. ; to dir.gc
  10.  
  11.  
  12. WINBIG 150 11 220 229   Devices
  13. WinType 11110001
  14. varpath ''
  15. nofontsense
  16.  
  17. xOnLoad
  18. setvar fm_mode 1
  19. setgad Dir.gc 2 HIDE       ; hide the gadgets of the
  20. setgad Dir.gc 10 HIDE      ; other half of the window
  21. setgad Dir.gc 11 HIDE
  22. setgad Dir.gc 12 HIDE
  23. setgad Dir.gc 13 HIDE
  24. setgad Dir.gc 14 HIDE
  25. setgad Dir.gc 15 HIDE
  26. setgad Dir.gc 16 HIDE
  27. setgad Dir.gc 17 HIDE
  28. guiopen Dir.gc
  29. guiload :Dir.g                        ; load the helper guis
  30. guiload guis:tools/cli.gc             ; the cli gui
  31. guiload guis:tools/ViewFile.g         ; auto view function
  32. guiload guis:tools/Prefs/players      ; the default viewers
  33. guiload :dir.fav                      ; the favourites gui
  34. setvar lv_fmscreen ""                 ; start by opening on WB
  35.  
  36. xonquit
  37. guiquit Dir.g        ; quit our other guis also
  38. guiquit ViewFile.g
  39. guiquit Dir.g2
  40. guiquit Dir.g3
  41. guiquit dir.g4
  42. guiquit cli.gc
  43. guiquit dir.prot
  44. guiquit dir.user
  45. guiquit dir.fav
  46.  
  47. xOnOpen
  48. SetGad dir.gc 20 OFF
  49.  
  50. xOnClose 
  51. SetGad dir.gc 20 ON
  52.  
  53.  
  54. xAppIcon 0 0 :dir.gc DIR.gc *lv_app OFF
  55. GadID 20
  56. GuiOpen dir.gc
  57. GuiScreen dir.gc FRONT
  58. if $*lv_app > " "
  59.    gosub dir.gc appdir 
  60. endif
  61.  
  62.  
  63. xAppWindow  *lv_app                ; The FM is also an AppWindow
  64. gosub dir.gc appdir                ; going to the dir of the icon..
  65.  
  66.  
  67. xroutine appdir                    ; cd to the appitem's dir
  68. ifexists DIR $*lv_app              ; if it's a dir,vol,dev or asn
  69. orifexists DOS $*lv_app
  70.     dir  = $*lv_app
  71.     file = ''
  72. elseifexists file $*lv_app          ; if it's a file
  73.     extract *lv_app PATH dir
  74.     extract *lv_app FILE file
  75. endif
  76. lvuse dir.gc 1
  77. lvdir #$dir
  78. lvfind $file
  79. setwintitle dir.gc '$dir                                 '
  80. delvar *lv_app
  81.  
  82. xOnRMB
  83. guiopen Dir.g     ; This has the copy, delete etc functions
  84.  
  85.  
  86. xOnJump lv_newscreen                ; If the user jumps screens
  87. setscreen Dir.g $lv_newscreen       ; we have to make the other GUIs
  88. setscreen Dir.g2 $lv_newscreen      ; follow also..
  89. setscreen Dir.g3 $lv_newscreen
  90. setscreen Dir.g4 $lv_newscreen
  91. setscreen Dir.gv $lv_newscreen
  92. setscreen cli.gc $lv_newscreen
  93. setscreen dir.user $lv_newscreen
  94. setscreen dir.fav $lv_newscreen
  95. *SCREEN = $lv_newscreen             ; store screen name in a global
  96.                                     ; var, for other guis.
  97.  
  98.  
  99. ;========================= The Directory ListViews ==================
  100. ; Note they both have Hooks to display the current dir to the user.
  101.  
  102. ;---------> the left side
  103.  
  104. XLISTVIEW 0 0 204 228              "" lv_file "" 10 DIR
  105. gadid 1
  106. lvdirhook 1
  107. GadFont topaz.font 8 000        ; CHANGE THIS TO THE FONT YOU LIKE!
  108. ;LVColors   2 1 3 2
  109. guiopen Dir.g2
  110.  
  111. xLVDirHook 1
  112. setwintitle Dir.gc '$$lv.dir                                  '   ; show it in the wintitle
  113.  
  114. ;----------> the right side
  115.  
  116. XLISTVIEW 220 16 205 212              "" lv_file "" 10 DIR
  117. gadid 2
  118. lvdirhook 2
  119. GadFont topaz.font 8 000        ; CHANGE THIS TO THE FONT YOU LIKE!
  120. guiopen Dir.g2
  121.  
  122. xLVDirHook 2
  123. update Dir.gc 10 $$lv.dir       ; show it in xTextIn gadget below
  124.  
  125. XTEXTIN 220 0 204 16             "" lvdir2 "" 140
  126. gadid 10
  127. GadFont topaz.font 8 000
  128. lvuse dir.gc 2
  129. LVDir #$lvdir2   ; you can change the dir from here
  130.  
  131.  
  132.  
  133. ;======================== The Action buttons ==========================
  134.  
  135. ;--------> for the left side (source)
  136.  
  137. XBUTTON 205 0 14 13  P
  138. lvuse dir.gc 1
  139. LVDir parent
  140. lv_ir1 = $$LV_DIR
  141. setwintitle Dir.gc '$$lv.dir                                        '
  142.  
  143. XBUTTON 205 13 14 13 R
  144. lvuse dir.gc 1
  145. LVDir Root
  146. lv_dir1 = $$LV_DIR
  147. setwintitle Dir.gc '$$lv.dir                                        '
  148.  
  149. XBUTTON 205 26 14 13 D
  150. lvuse dir.gc 1
  151. LVDir Disks
  152. lv_dir1 = ""
  153. setwintitle Dir.gc 'Devices'
  154.  
  155. XBUTTON 205 39 14 13 A
  156. lvuse dir.gc 1
  157. LVDir all
  158.  
  159. XBUTTON 205 52 14 13 N
  160. lvuse dir.gc 1
  161. LVDir None
  162.  
  163. XBUTTON 205 65 14 15 F
  164. favid = 1
  165. guiopen dir.fav
  166.  
  167. XBUTTON 205 177 14 12 +      ; add to favourites
  168. lvuse dir.gc 1
  169. gosub dir.fav addfav
  170.  
  171. XBUTTON 205 189 14 13 R
  172. lvuse dir.gc 1
  173. lvdir Refresh
  174.  
  175. XBUTTON 205 202 14 13                <       ; move list left
  176. lvuse dir.gc 1
  177. lvmove -10
  178.  
  179. XBUTTON 205 215 14 13                >
  180. lvuse dir.gc 1
  181. lvmove 10
  182.  
  183. ;---------> for the right side (destination) give gadID so we set them on/off
  184.  
  185. XBUTTON 426 0 14 13             P
  186. GadID 11
  187. lvuse dir.gc 2
  188. LVDir parent
  189. setvar lv_dir2 $$LV.DIR
  190. update Dir.gc 10 $$lv.dir
  191.  
  192. XBUTTON 426 13 14 13             R
  193. gadid 12
  194. lvuse dir.gc 2
  195. LVDir Root
  196. setvar lv_dir2 $$LV.DIR
  197. update Dir.gc 10 $$lv.dir
  198.  
  199. XBUTTON 426 26 14 13             D
  200. gadid 13
  201. lvuse dir.gc 2
  202. LVDir Disks
  203. setvar lv_dir2 ""
  204. update Dir.gc 10 ""
  205.  
  206. XBUTTON 426 39 14 13             A
  207. gadid 14
  208. lvuse dir.gc 2
  209. LVDir All
  210.  
  211. XBUTTON 426 52 14 13             N
  212. gadid 15
  213. lvuse dir.gc 2
  214. LVDir None
  215.  
  216. XBUTTON 426 65 14 15    F
  217. gadid 151
  218. favid = 2
  219. guiopen dir.fav
  220.  
  221. XBUTTON 426 178 14 11              +      ; add to favourites
  222. lvuse dir.gc 2
  223. gosub dir.fav addfav
  224.  
  225. XBUTTON 426 189 14 13              R
  226. lvuse dir.gc 2
  227. lvdir Refresh
  228.  
  229. XBUTTON 426 202 14 13              <    ; move list left
  230. GadID 16
  231. lvuse dir.gc 2
  232. lvmove -10
  233.  
  234. XBUTTON 426 215 14 13              >    ; move list right
  235. GadID 17
  236. lvuse dir.gc 2
  237. lvmove 10
  238.  
  239. ;---------> open full file manager
  240.  
  241. XBUTTON 205 108 14 11             >
  242. gadid 21
  243. if $fm_mode = 1
  244.    gosub Dir.gc OpenWindow
  245. else
  246.    gosub Dir.gc CloseWindow
  247. endif
  248.  
  249.  
  250. ;--------> button to switch left <-> right lvs
  251.  
  252. XBUTTON 205 119 14 11             x
  253. gadid  20
  254. lvuse dir.gc 1
  255. tempdir1 = $$lv.dir
  256. lvuse dir.gc 2
  257. tempdir2 = $$lv.dir
  258. lvdir #$tempdir1
  259. lvuse dir.gc 1
  260. lvdir #$tempdir2
  261. setwintitle Dir.gc '$tempdir2                                ' ; and their dir displays
  262. update Dir.gc 10 $tempdir1
  263. delvar tempdir#?
  264.  
  265.  
  266. ;--------> same directories
  267.  
  268. XBUTTON 205 130 14 11               =
  269. if $$lv.gui == dir.gc        ; check that the internal vars point to us
  270.    id  = $$lv.id
  271.    dir = $$lv.dir
  272.    if $id = 1
  273.       lvuse dir.gc 2 
  274.       lvdir #$dir
  275.       update Dir.gc 10 $dir
  276.    else
  277.       lvuse dir.gc 1
  278.       lvdir #$dir
  279.       setwintitle Dir.gc '$dir                                    '
  280.    endif
  281. endif
  282.  
  283. ;---------> open favourites gui
  284.  
  285. XBUTTON 205 65 14 15                 F
  286. favid = 1
  287. guiopen dir.fav
  288.  
  289.  
  290. ;---------> ROUTINES
  291.  
  292. xRoutine OpenWindow     ; Routine to enlarge the window
  293.    fm_mode = 2
  294.    setgad Dir.gc 2   SHOW
  295.    setgad Dir.gc 10  SHOW
  296.    setgad Dir.gc 11  SHOW
  297.    setgad Dir.gc 12  SHOW
  298.    setgad Dir.gc 13  SHOW
  299.    setgad Dir.gc 14  SHOW
  300.    setgad Dir.gc 15  SHOW
  301.    setgad Dir.gc 151 SHOW
  302.    setgad Dir.gc 16  SHOW
  303.    setgad Dir.gc 17  SHOW
  304.    changearg Dir.gc 21 4 <
  305.    changegad Dir.gc 0 -1 -1 440 229 ""
  306.    redraw Dir.gc
  307.  
  308. xRoutine CloseWindow    ; make it small again
  309.    fm_mode = 1
  310.    setgad Dir.gc 2   HIDE
  311.    setgad Dir.gc 10  HIDE
  312.    setgad Dir.gc 11  HIDE
  313.    setgad Dir.gc 12  HIDE
  314.    setgad Dir.gc 13  HIDE
  315.    setgad Dir.gc 14  HIDE
  316.    setgad Dir.gc 15  HIDE
  317.    setgad Dir.gc 151 HIDE
  318.    setgad Dir.gc 16  HIDE
  319.    setgad Dir.gc 17  HIDE
  320.    changegad Dir.gc 0 -1 -1 220 229 ""
  321.    changearg Dir.gc 21 4 >
  322.    redraw Dir.gc
  323.  
  324.  
  325.